﻿Imports System.ComponentModel
Imports System.Web.UI
Imports System.Text

Namespace Controls
    ''' <summary> 
    ''' 提示信息控件 
    ''' </summary> 
    <DefaultProperty("Text"), ToolboxData("<{0}:Hint runat=server></{0}:Hint>")> _
    Public Class Hint
        Inherits System.Web.UI.WebControls.WebControl

#Region "Property HintImageUrl"

        ''' <summary> 
        ''' 图片地址 
        ''' </summary> 
        <Bindable(True), Category("Appearance"), DefaultValue("")> _
        Public Property HintImageUrl() As String
            Get
                If MyBase.ViewState("hintimageurl") IsNot Nothing Then
                    Return DirectCast(MyBase.ViewState("hintimageurl"), String)
                Else
                    Return "../images"
                End If
            End Get
            Set(ByVal value As String)
                MyBase.ViewState("hintimageurl") = value
            End Set
        End Property

#End Region

        ''' <summary> 
        ''' 输出html,在浏览器中显示控件 
        ''' </summary> 
        ''' <param name="output"></param> 
        Protected Overloads Overrides Sub Render(ByVal output As HtmlTextWriter)
            Dim sb As New StringBuilder()

            sb.Append("<!--提示层部分开始-->")

            sb.Append("<span id=""hintdivup"" style=""display:none; position:absolute;z-index:500;"">" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<div style=""position:absolute; visibility: visible; width: 271px;z-index:501;"">" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<p><img src=""" + Me.HintImageUrl + "/commandbg.gif"" /></p>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<div class=""messagetext""><img src=""" + Me.HintImageUrl + "/dot.gif"" /><span id=""hintinfoup"" ></span></div>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<p><img src=""" + Me.HintImageUrl + "/commandbg2.gif"" /></p>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("</div>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<iframe id=""hintiframeup"" style=""position:absolute;z-index:100;width:266px;scrolling:no;"" frameborder=""0""></iframe>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("</span>" & Chr(13) & "" & Chr(10) & "")


            sb.Append("<span id=""hintdivdown"" style=""display:none; position:absolute;z-index:500;"">" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<div style=""position:absolute; visibility: visible; width: 271px;z-index:501;"">" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<p><img src=""" + Me.HintImageUrl + "/commandbg3.gif"" /></p>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<div class=""messagetext""><img src=""" + Me.HintImageUrl + "/dot.gif"" /><span id=""hintinfodown"" ></span></div>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<p><img src=""" + Me.HintImageUrl + "/commandbg4.gif"" /></p>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("</div>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("<iframe id=""hintiframedown"" style=""position:absolute;z-index:100;width:266px;scrolling:no;"" frameborder=""0""></iframe>" & Chr(13) & "" & Chr(10) & "")
            sb.Append("</span>" & Chr(13) & "" & Chr(10) & "")

            sb.Append("<!--提示层部分结束-->" & Chr(13) & "" & Chr(10) & "")

            output.Write(sb.ToString())
        End Sub

    End Class
End Namespace